package com.qc.ayouth.shop.core.beans.bo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 
    * @ClassName: 列表数据格式
    *
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PageBO<D> implements Serializable {

	private D dto;

	// 总记录数
	private long total;

	// 列表数据
	private List<D> rows;

	// 当前第几页
	private long pageNo=1;

	//总页数
	private long pageCount;

	// 一页多少条
	private long pageSize=10;

	//是否还有下一页
	private boolean hasNext=true;

	public PageBO() {
	}

	public PageBO(long total,  List<D> rows) {
		this.total = total;
		this.rows = rows;
	}

	public PageBO(long total, long pageSize, List<D> rows) {
		this.total = total;
		this.rows = rows;
		this.pageCount = (total + pageSize - 1)/pageSize;
	}

	public PageBO(long total, long pageSize, int pageNo, List<D> rows) {
		this.total = total;
		this.rows = rows;
		this.pageNo = pageNo;
		this.pageCount = (total + pageSize - 1)/pageSize;
	}

	public PageBO(long total, long pageCount, long pageNo, List<D> rows) {
		this.total = total;
		this.pageCount = pageCount;
		this.pageNo = pageNo;
		this.rows = rows;
	}

	public PageBO(long total, List<D> rows, boolean hasNext) {
		this.total = total;
		this.rows = rows;
		this.hasNext=hasNext;
	}
}

